package model;

public class User extends PersistentEntity implements Comparable<User> {
  private String name;
  private String password;
  private String mail;

  public User(String name, String password, String mail){
    super();

    this.name = name;
    this.password = password;
    this.mail = mail;
  }


  public String getName() {
    return name;
  }
  public void setName(String name) {
    this.name = name;
  }
  public String getPassword() {
    return password;
  }
  public void setPassword(String password) {
    this.password = password;
  }
  public String getMail() {
    return mail;
  }
  public void setMail(String mail) {
    this.mail = mail;
  }


  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((name == null) ? 0 : name.hashCode());
    return result;
  }


  @Override
  public boolean equals(Object obj) {
    if (this == obj)
      return true;
    if (obj == null)
      return false;
    if (getClass() != obj.getClass())
      return false;
    User other = (User) obj;
    if (name == null) {
      if (other.name != null)
        return false;
    } else if (!name.equals(other.name))
      return false;
    return true;
  }

  @Override
  public int compareTo(User o) {
      return this.name.compareTo(((User)o).name);
  }


  public boolean validate(String pass) {
    if(this.password.equals(pass)){
      return true;
    }
    return false;
  }
  
}
